package com.gitee.hermer.engine.jars.core.execute;

import org.springframework.context.ApplicationContext;

import com.gitee.hermer.engine.jars.core.app.domain.EngineAppJobContext;
import com.gitee.hermer.engine.jars.core.context.domain.EngineAppContext;
import com.gitee.hermer.engine.jars.core.execute.domain.ExecuteParamsInfo;

public abstract class EngineExecuteRunnable extends EngineExecuteThread implements Runnable{

	public EngineExecuteRunnable(ApplicationContext contextParent, String cacheKey, LifeCycle cycle) {
		super(contextParent, cacheKey, cycle);
	}
	
	public EngineExecuteRunnable(EngineAppJobContext context,String cacheKey,ExecuteParamsInfo paramsInfo,LifeCycle cycle){
		super(context, cacheKey, paramsInfo, cycle);
	}

	@Override
	public void run() {
		try{
			onBeginExecute();
			onExecute();
		}catch (Throwable e) {
			error(e.getMessage(),e);
		}finally {
			onEndExecute();
		}
	}
	
	

}
